# -*- coding: utf-8 -*-
# @Time : 2021/12/22 17:23
# @Author : Limusen
# @File : demo_ui_mouse_07

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 引入鼠标类
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")

# 创建鼠标对象
mouse_action = ActionChains(driver)
# 创建元素对象
e1 = driver.find_element(By.XPATH, '//body[1]/div[1]/div[1]/div[3]/a[1]')
# 操作鼠标点击对象
# mouse_action.click(e1).release().perform()

# 双击
# el = driver.find_element(By.ID, "su")
# driver.find_element(By.NAME, 'wd').send_keys("惆怅长岑长")
# time.sleep(2)
# mouse_action.double_click(el).perform()

# 鼠标悬停
el2 = driver.find_element(By.ID,'s-usersetting-top')
mouse_action.move_to_element(el2).perform()
time.sleep(2)
driver.find_element(By.LINK_TEXT,'高级搜索').click()

time.sleep(2)
driver.quit()